<template >
    <div>
        <h1>当前求和{{sum}}</h1>
        <h2>当前求和乘以10倍{{bigSum}}</h2>
        <h3>我在{{school}}学{{subject}}</h3>
        <h3>下方组件的总人数{{personList.length}}</h3>
        <select v-model="n">
            <option :value="1">1</option>
            <option :value="2">2</option>
            <option :value="3">3</option>
        </select>
        <button @click="JIA(n)">+</button>
        <button @click="JIAN(n)">-</button>
        <button @click="jiaOdd(n)">当前求和为奇数时再加</button>
        <button @click="jiaWait(n)">等一等再加</button>
    </div>
</template>
<script>
import {mapState,mapGetters,mapMutations,mapActions} from 'vuex'
export default {
    name:'Count',
    data() {
        return {
            n:1
        }
    },
    methods: {
        ...mapMutations('countAbout',['JIA','JIAN']),
        ...mapActions('countAbout',['jiaOdd','jiaWait'])
    },
    computed:{
        ...mapState('countAbout',['sum','school','subject']),
        ...mapState('personAbout',['personList']),
        ...mapGetters('countAbout',['bigSum'])
    },
    mounted(){
        const x = mapState({he:'sum',xuexiao:'school',xueke:'subject'})
        console.log(this.$store)
    }
}
</script>
<style lang="css">
    button{
        margin-left: 5px;
    }
</style>